# ---------- ---------- ---------- ---------- ---------- ----------
#   workspaces-v makefile
# ---------- ---------- ---------- ---------- ---------- ----------

UserAt=$(if $(u),-u $(u),)
Build=$(if $(b),-b $(b),-b stable)
ProtoPathToHardMake=./lib/hardmake/
PathToHardMake=-p $(ProtoPathToHardMake)
HardMake=$(ProtoPathToHardMake)hardmake.sh

ConfigFileBase=-f dependencies-base.yaml
ConfigFilePeers=-f dependencies-peers.yaml
ConfigFile=-f dependencies.yaml

IngredientsBase=-i '\
dotfiles \
cyberpunk2019 \
hardmake \
muttrc \
protoculture \
'

IngredientsContrib=-i '\
Gnusocial \
'

IngredientsPeers=-i '\
PeersBountyHunts \
PeersTemplate \
PeersWww \
ProjectJams \
peerskart \
PeersMirrors \
'

Ingredients=-i '\
AwesomeTtrpg \
BearAdventures \
CodeExamples \
DokkTtrpg \
DragoraBuild \
GhodssYaml \
GnusocialTracker \
MfwsFe \
OrbitalDrydock \
QemuSubsystems \
ResponsivePelican \
SelfSovereignID \
YesodMyblog \
apiPublicInformation \
foolkicker \
langskip \
langskip2 \
sins \
staticSiteGenerator \
'

target: help

# ---------- ---------- ---------- ---------- ---------- ----------
#NOTE: The remaining recipes follow:
# ---------- ---------- ---------- ---------- ---------- ----------

.PHONY: help
help:
	@echo help says:
	@echo Type \"make int\" to install the dependencies.
	@echo See makefile for more info.
	@echo Optionally, append \"u=foo\" for a user named foo.
	@echo $(UserAt)

.PHONY: clean
clean:
	rm -r ./bin

.PHONY: init
init: hardmake deps

.PHONY: hardmake
hardmake:
	git clone https://notabug.org/vaeringjar/hardmake.git $(ProtoPathToHardMake)

.PHONY: test
test:
	@$(HardMake) $(PathToHardMake) $(ConfigFileBase) $(IngredientsBase) $(Build) $(UserAt)
	@echo done

.PHONY: deps
deps:
	@echo Next: you should manually choose a deps option:
	@echo     make deps-all
	@echo     make deps-base
	@echo     make deps-peers
	@echo     make deps-main

.PHONY: deps-all
deps-all: deps-base deps-contrib deps-peers deps-main

.PHONY: deps-base
deps-base:
	@$(HardMake) -d $(PathToHardMake) $(ConfigFileBase) $(IngredientsBase) $(Build) $(UserAt)
	@echo done

.PHONY: deps-contrib
deps-contrib:
	@$(HardMake) -d $(PathToHardMake) $(ConfigFile) $(IngredientsContrib) $(Build) $(UserAt)
	@echo done

.PHONY: deps-peers
deps-peers:
	@$(HardMake) -d $(PathToHardMake) $(ConfigFilePeers) $(IngredientsPeers) $(Build) $(UserAt)
	@echo done

.PHONY: deps-main
deps-main:
	@$(HardMake) -d $(PathToHardMake) $(ConfigFile) $(Ingredients) $(Build) $(UserAt)
	@echo done

.PHONY: status
status:
	@./src/make/status.sh
